<?php
	$importFieldOptions = ClassRegistry::getObject($importModelAlias)->getImportFieldsAsOtpions();
	echo sprintf(__("%d records has been saved. %d lines out of %d lines has some errors."),$result['savedRecordCount'],$result['totalLineCount']- $result['savedRecordCount'],$result['totalLineCount'],$result['totalLineCount']);
	
?>
<table>
	<tr>
		<th><?php echo __("Line")?></th>
		<th><?php echo __("Errors")?></th>
	</tr>
<?php foreach($result['errors'] as $error){?>
	<tr>
		<td>
		<?php 
			$csvLine = implode(",",$error['line']);
		?>
		<?php echo $form->input("line",array("type"=>"text","value"=>$csvLine,"maxlength"=>strlen($csvLine)))?>
		</td>
		<td>
			<?php
				$errorHtml = ""; 
				if(!$error['errors'])
				{
					$error['errors'] = array();
				}
				foreach($error['errors'] as $field => $validationError)
				{
					$fieldLabel = $importFieldOptions[$field];
					$errorHtml .= "<span>$fieldLabel: $validationError</span><br />";
				}
				echo $errorHtml;
			?>
		</td>
	</tr>
<?php }?>
</table>